<?php
	require_once("conexion/conexion.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Formulario PSMB</title>
<link href="Estilos/global.css" rel="stylesheet" type="text/css" />
<link href="Estilos/local.css" rel="stylesheet" type="text/css" />
<link href="Estilos/CssTabla3.css" rel="stylesheet" type="text/css" />
<link href="Estilos/jquery.autocomplete.css" rel="stylesheet" type="text/css" />

<script src="include_js/jquery.js" type="text/javascript"></script>
<style>
.borde
{
	border:1px solid #6593C0;
}
.texto
{
	color:#FFFFFF; 
	font-weight:bold;
}
</style>
<script>
function validar(e)
{ 
    tecla = (document.all) ? e.keyCode : e.which; 
    if (tecla==8) return true; //Tecla de retroceso (para poder borrar) 
    patron = /\d/; //ver nota 
    te = String.fromCharCode(tecla); 
    return patron.test(te);  
}
</script>
</head>
<body>
<form name="form_historico" id="form_historico" method="post">
<div class='option2'><label style="font:Verdana, Arial, Helvetica, sans-serif; color:#0066CC; font-weight:bold;">Listado Factura Clientes.</label></div>
<div class='groupbox'>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="25%" class="borde"><label class="texto">N&uacute;mero Factura</label></td>
    <td width="55%" class="borde"><label class="texto">Fecha Desde</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<label class="texto">Fecha Hasta</label></td>
    <td width="20%" class="borde">&nbsp;</td>
  </tr>
  <tr>
    <td class="borde"><input name="txtFactura" type="text" size="15" onkeypress="return validar(event)" title="N&uacute;mero de la Factura" /></td>
	  <td class="borde"><input name="txtFIni" type="text" id="txtFIni" size="10">&nbsp;<img src="imagen/img.gif" width="20" height="14" title="calendario" style="cursor: pointer; border: 1px solid green;" onmouseover="this.style.background='black';" onmouseout="this.style.background=''" onclick="popUpCalendar(txtFIni, form_historico.txtFIni, 'dd-mm-yyyy');" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name="txtFFin" type="text" id="txtFFin" size="10">&nbsp;<img src="imagen/img.gif" width="20" height="14" title="calendario" style="cursor: pointer; border: 1px solid green;" onmouseover="this.style.background='black';" onmouseout="this.style.background=''" onclick="popUpCalendar(txtFFin, form_historico.txtFFin, 'dd-mm-yyyy');" /></td>
	  <td class="borde"><input name="btn_Buscar" id="btn_Buscar" type="button" value=" " class="buscar" /></td>
  </tr>
  <tr>
    <td class="borde" colspan="2"><label class="texto">Clientes</label></td>
    <td class="borde">&nbsp;</td>
  </tr>
  <tr>
    <td class="borde" colspan="3"><select name="cmb_Cliente" id="cmb_Cliente">
          <option value="0">--CLIENTE--</option>
          <?php
		  		//clientes de area
            	/*$con = new Conexion();
        		$con2 = $con->conexionBD("fpproduccion");
                $sql = "select CliRut,CliRSocial from clientes";
                $resultado = mysql_query($sql) or die ($con->error_mysql("Error en la consulta".mysql_error()));
				$fila = mysql_num_rows($resultado);
				while ($row = mysql_fetch_row($resultado))
				{
					echo "<option value='".$row[0]."'>".$row[1]."</option>";
				}
                $con->cerrarBD();*/
				//otros clientes
				$con = new Conexion();
        		$con2 = $con->conexionBD("fpproduccion");
                $sql = "select OCliRut,OCliRSocial from otrosclientes where 1 order by OCliRSocial asc";
                $resultado = mysql_query($sql) or die ($con->error_mysql("Error en la consulta".mysql_error()));
				$fila = mysql_num_rows($resultado);
				while ($row = mysql_fetch_row($resultado))
				{
					$dato = utf8_decode($row[1]);
					echo "<option value='".$row[0]."'>".$dato."</option>";
				}
                $con->cerrarBD();
		?>
        </select></td>
  </tr>
</table>
</div>
</form>

<table width="100%" border="0" cellpadding="2" cellspacing="0">
  <tr>
    <td style="text-align:center;"><div id="lista"></div></td>
  </tr>
</table>
</body>
<script>
$('#btn_Buscar').click(function() 
{ 
	 $('#lista').html("<img src='imagen/Loading.gif' width='49' height='50'> Cargando ...");
        $.ajax({
            type: 'POST',
            url: 'Contabilidad/carga_historico.php',
            data: $('#form_historico').serialize(),
            success: function(data) {
                $('#lista').html(data);
            }
        })
});
</script>
</html>